Learn R Programming

cubfits (version 0.1-2)

Randomize SCUO Index: Generate Randomized SCUO Index

Description

Generate randomized SCUO indices in log normal distribution, but provided original unchanged SCUO order.

Usage

scuo.random(SCUO, phi.Obs = NULL, meanlog = .CF.PARAM$phi.meanlog, sdlog = .CF.PARAM$phi.sdlog)

Arguments

SCUO
SCUO index returned from calc_scuo_values().
phi.Obs
optional object of format phi.Obs.
meanlog
mean of log normal distribution.
sdlog
std of log normal distribution.

Value

A vector of log normal random variables is returned.

Details

This function takes SCUO indices (outputs of calc_scuo_values()) computes the rank of them, generates log normal random variables, and replaces SCUO indices by those variables in the same rank orders. Typically, these random variables are used to replace expression values when either no expression is observed or for the purpose of model validation.

If phi.Obs is provided, the mean and std of log(phi.Obs) are used for log normal random variables. Otherwise, menalog and sdlog are used.

The default meanlog and sdlog was estimated from yassour dataset.

References

https://github.com/snoweye/cubfits/

See Also

calc_scuo_values(), yassour.

Examples

Run this code
## Not run: 
# suppressMessages(library(cubfits, quietly = TRUE))
# 
# ### example dataset.
# y.scuo <- convert.y.to.scuo(ex.train$y)
# SCUO <- calc_scuo_values(y.scuo)$SCUO
# plotprxy(ex.train$phi.Obs, SCUO)
# 
# ### yassour dataset.
# GM <- apply(yassour[, -1], 1, function(x) exp(mean(log(x[x != 0]))))
# phi.Obs <- GM / sum(GM) * 15000
# mean(log(phi.Obs))
# sd(log(phi.Obs))
# ret <- scuo.random(SCUO, meanlog = -0.441473, sdlog = 1.393285)
# plotprxy(ret, SCUO)
# ## End(Not run)

Run the code above in your browser using DataLab